package com.wetool.wechat.model.dto;

import com.wetool.wechat.model.official.menu.AbstractMenuButton;
import com.wetool.wechat.model.official.menu.ButtonType;
import com.wetool.wechat.model.official.menu.MenuButton;
import com.wetool.wechat.model.official.menu.SubMenuButton;

import java.util.List;

public class MenuDto {

    private String name;
    private String url;

    private ButtonType buttonType;

    private List<MenuDto> subMenus;

    public AbstractMenuButton to() {

        switch (this.buttonType) {

            case CLICK: {
                MenuButton menuButton = new MenuButton(this.buttonType, this.name);
                if (subMenus != null && subMenus.size() > 0) {
                    subMenus.forEach(menuDto -> menuButton.addButton((SubMenuButton) menuDto.to()));
                } else {
                    menuButton.setUrl(this.url);
                }
                return menuButton;
            }
            case VIEW:
                break;
            case SCANCODE_PUSH:
                break;
            case SCANCODE_WAITMSG:
                break;
            case PIC_SYSPHOTO:
                break;
            case PIC_PHOTO_OR_ALBUM:
                break;
            case PIC_WEIXIN:
                break;
            case LOCATION_SELECT:
                break;
            case MEDIA_ID:
                break;
            case VIEW_LIMITED:
                break;
        }

        return null;
    }

    private void handleSubButton() {

    }
}
